import React, { Component } from 'react'
import { Button, Text, View,StyleSheet } from 'react-native'
/**
 * input: user
 * output:
 *  onDelete:
 *      param: user.id
 *  onUpdate
 *      param: user.id
 */
export default class UserShow extends Component {
    _delete=()=>this.props.onDelete(this.props.user.id)
    _update=()=>this.props.onUpdate(this.props.user.id)
    render() {
        return (
            <View style={{flexDirection:'row',justifyContent:'space-between'}}>
                <Text style={styles.userTxt}> {this.props.user.uname} </Text>
                <Text style={styles.userTxt}> {this.props.user.address} </Text>
                <Button title="删除" onPress={this._delete}/>
                <Button title="更新"  onPress={this._update}/>
            </View>
        )
    }
}

const styles = StyleSheet.create({
    userTxt:{fontSize:30}
})

